Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract shaderstore into separate file #1

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jelster
Copy link

@jelster jelster commented May 8, 2021

Moved the shader declarations into their own file, loaded into the context via a script tag in the HTML document. Because this isn't a context where ES6 modules or require are present, this seemed to be the simplest way to get it to work.

This will allow the shaders to be loaded by themselves into the PG using the appropriate URL, as a side-note

@jelster
Copy link
Author

jelster commented May 8, 2021

The correct URL to reference this (e.g., the PR) version of the shaderstore in PG - https://raw.githubusercontent.com/erichlof/Babylon.js-PathTracing-Renderer/258c640319d07147b98486d5cc985855bfa3b044/js/shaderstore-import.js

Reference in the PG like this:

const url = "https://raw.githubusercontent.com/erichlof/Babylon.js-PathTracing-Renderer/258c640319d07147b98486d5cc985855bfa3b044/js/shaderstore-import.js";
var s = document.createElement("script");
s.src = url;
document.head.appendChild(s);

Then, make sure scene creation logic dependent upon it runs after the script loads, use

s.onload = function() { // scene init logic here }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant